<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="todo-list-example">
        <!-- v-on:submit.prevent 执行方法【不需要括号（）结尾】 -->
        <form v-on:submit.prevent="addNewTodo">
          <label for="new-todo">Add a todo</label>
          <!-- input中绑定对应的双向绑定对象 -->
          <input
            v-model="newTodoText"
            id="new-todo"
            placeholder="E.g. Feed the cat"
          >
          <button>Add</button>
        </form>
        <!-- 如何在模板中使用v-for -->
        <ul>
            <!-- is就是组件对象 -->
          <li
            is="todo-item"
            v-for="(todo, index) in todos"
            v-bind:key="todo.id"
            v-bind:title="todo.title"
            v-on:remove="todos.splice(index, 1)"
          ></li>
          <!-- 从data中删除本项 -->
          <!-- items.splice(index, 1) -->
        </ul>
      </div>
    <script src="vue.js"></script>
</body>
</html>